A slice is inclusive of the starting index and exclusive of the ending index.
def slice5(s):
c = s[2:5]
return c
| Function Call | Return Value | |||
|---|---|---|---|---|
| slice5('Garage') | → | |||
| slice5('Track') | → | |||
| slice5('556843') | → | |||
| slice5('Elephant') | → | |||
| slice5('Violets') | → | |||
Experiment with this code on Gitpod.io